<?Lassoscript
// Last modified 9/24/10 by ECL, Landmann InterActive
/*
Tagdocs;
	{Tagname=			OutputPageBottom }
	{Description=		Outputs information that should be at the end of the page }
	{Author=			Eric Landmann }
	{AuthorEmail=		support@iterate.ws }
	{ModifiedBy=		}
	{ModifiedByEmail=	}
	{Date=				9/24/10 }
	{Usage=				OutputPageBottom }
	{ExpectedResults=	Whatever is called here. Currently used for Google Analytics. }
	{Dependencies=		none }
	{DevelNotes=		none }
	{ChangeNotes=		9/24/10 - First implementation.
						2/20/11 - Added version check using $svVersion }
/Tagdocs;
*/
If(!(Lasso_TagExists:'OutputPageBottom'));
	Define_Tag('OutputPageBottom',
		-Description='Outputs information that should be at the end of the page');

		Local('Result') = null;

		// Output Google Analytics
		If(Var('svSys_GoogleTracker') != '');
			#Result += '<!-- OutputPageBottom -->\n';
			If(Var('svVersion') == '4.0');
				Local('TheDirectory' = '/skin/js/');
			Else;
				Local('TheDirectory' = '/site/js/');
			/If;
			#Result += (('<script type="text/javascript" src="'+(#TheDirectory)+'jquery.ga.js"></script>
<script type="text/javascript">
	$(document).ready( function() { $.ga.load("')+($svSys_GoogleTracker)+('"); } );
</script>'));
			Return(Encode_Smart(#Result));

		Else;

			// Output a comment that variable is not defined
			#Result = '<!-- OutputPageBottom: Google Tracker is undefined -->\n';

			Return(Encode_Smart(#Result));

		/If;

	/Define_Tag;

	Log_Critical('Custom Tag Loaded - OutputPageBottom');

/If;
?>